﻿<!--
<copyright file="SequenceLine.xaml" company="Microsoft">
//  Copyright (c) Microsoft Corporation.  All rights reserved.
</copyright>
-->

<UserControl x:Class="SequenceAssembler.SequenceLine"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:SequenceAssembler"
             mc:Ignorable="d" 
             d:DesignHeight="35" d:DesignWidth="300">
    <UserControl.Resources>
        <Style x:Key="RemoveButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Canvas Width="14" Height="14" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Ellipse Stroke="{x:Null}" Width="14" Height="14" x:Name="ellipse" ToolTip="{DynamicResource ToolTip_Removefromworkspace}">
                                    <Ellipse.Fill>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FF414141" Offset="0"/>
                                            <GradientStop Color="#FF1C1C1C" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Ellipse.Fill>
                                </Ellipse>
                                <Path Stretch="Fill" Stroke="#FFFFFFFF" Width="6" Height="6" Data="M3.1218693,3.01 L7.0802027,6.9683333" Canvas.Left="4" Canvas.Top="4" StrokeThickness="1.5" IsHitTestVisible="False"/>
                                <Path Stretch="Fill" Stroke="#FFFFFFFF" StrokeThickness="1.5" Width="6" Height="6" Data="M3.1218693,3.01 L7.0802027,6.9683333" Canvas.Left="4" Canvas.Top="4" RenderTransformOrigin="0.5,0.5" IsHitTestVisible="False">
                                    <Path.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="90"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </Path.RenderTransform>
                                </Path>
                            </Canvas>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="Fill" TargetName="ellipse">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFEC340C" Offset="0"/>
                                            <GradientStop Color="#FF990000" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="ellipse">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFEC340C" Offset="0"/>
                                            <GradientStop Color="#FF990000" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Fill" TargetName="ellipse">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFC40B0B" Offset="0"/>
                                            <GradientStop Color="#FF970000" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Key="ShowCloseButton">
            <DoubleAnimation From="0.0" To="1.0" Duration="0:0:.5" Storyboard.TargetName="closeSequenceButton" Storyboard.TargetProperty="Opacity" />
        </Storyboard>
        <Storyboard x:Key="HideCloseButton">
            <DoubleAnimation From="1.0" To="0.0" Duration="0:0:.5" Storyboard.TargetName="closeSequenceButton" Storyboard.TargetProperty="Opacity" />
        </Storyboard>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="MouseEnter" SourceName="containerGrid">
            <BeginStoryboard Storyboard="{StaticResource ShowCloseButton}" />
        </EventTrigger>
        <EventTrigger RoutedEvent="MouseLeave" SourceName="containerGrid">
            <BeginStoryboard Storyboard="{StaticResource HideCloseButton}" />
        </EventTrigger>
    </UserControl.Triggers>
    
    <Grid x:Name="containerGrid" HorizontalAlignment="Left" Margin="0,2,0,2">        
        <Grid.RowDefinitions>
            <RowDefinition x:Name="metadataRow"/>
            <RowDefinition x:Name="sequenceRow"/>
        </Grid.RowDefinitions>

        <TextBlock x:Name="metadataBlock" Grid.Row="0" Opacity=".6" />

        <Border x:Name="SequenceItemsHighlight" Visibility="Hidden" BorderThickness="0,2,0,2" Margin="0,-2,0,-2" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="Black" />
        <Border x:Name="sequenceItemsBorder" Grid.Row="1" BorderThickness="0,2,0,2" CornerRadius="3" BorderBrush="LimeGreen" HorizontalAlignment="Left" UseLayoutRounding="True">
            <StackPanel x:Name="sequenceItemsPanel" Margin="0,0,0,0" Orientation="Horizontal" HorizontalAlignment="Left"/>
        </Border>

        <Button x:Name="closeSequenceButton" Style="{StaticResource RemoveButton}" Click="OnCloseSequenceButtonClick" Width="14" Height="14" Margin="0,-5,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" Opacity="0.0" Panel.ZIndex="0" />
    </Grid>
</UserControl>
